lasio
uses the logging
module to log warnings and other information when manipulating LAS files.
In [1]:
import logging
import lasio
Sometimes you may want more or less information shown to you when you are reading LAS files with lasio
.
By default the logging level is set to WARNING
, so you will only see a certain class of messages:
In [2]:
l = lasio.read('../tests/examples/logging_levels.las')
As you can see, the logger shows a warning that the Parmeter section was not found in the LAS file.
To get more information when loading a file, you can set the logging level to INFO
. First, instantiate the root logger with a basic configuration:
In [3]:
logging.basicConfig()
Then get the lasio
logger object and set the logging level to INFO
:
In [4]:
logger = logging.getLogger(lasio.__name__)
logger.setLevel(logging.INFO)
l = lasio.read('../tests/examples/logging_levels.las')
To get even more information, you can set the logging level to DEBUG
:
In [5]:
logger.setLevel(logging.DEBUG)
l = lasio.read('../tests/examples/logging_levels.las')
One strategy for suppressing logging messages is to set the logger level to a very high level, such that only messages with a CRITICAL
designation are shown:
In [6]:
logger.setLevel(logging.CRITICAL)
l = lasio.read('../tests/examples/logging_levels.las')
In that case, no messages were logged since no CRITICAL level issues were encountered.
Just to prove that the LAS file loaded, even though no messages were shown, here's a header item:
In [7]:
l.header['Well'].SRVC
Out[7]: